Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strip-outer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strip-outer

Strip a substring from the start/end of a string

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is strip-outer?

The strip-outer npm package is designed to remove the outermost matching substring from a given string. It is particularly useful for trimming specific characters or patterns from the start and end of strings, allowing for more precise string manipulation than traditional trim methods.

What are strip-outer's main functionalities?

Strip specific characters from the start and end of a string

This feature allows you to remove specific characters or patterns from both the start and end of a string. In the provided code sample, the 'strip-outer' package is used to remove the '---' characters from around the 'Hello World' string.

"use strict";\nconst stripOuter = require('strip-outer');\nconsole.log(stripOuter('---Hello World---', '---')); // 'Hello World'

Strip patterns using regular expressions

This feature demonstrates the ability to use regular expressions to define the pattern to be stripped from the string. In the example, all '#' characters are removed from the start and end of the 'Hello World' string.

"use strict";\nconst stripOuter = require('strip-outer');\nconsole.log(stripOuter('###Hello World###', /#+/)); // 'Hello World'

Other packages similar to strip-outer

Keywords

FAQs

Package last updated on 19 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc